package me.zhengjie.base;

import io.swagger.annotations.ApiModel;
import lombok.Data;
import me.zhengjie.config.DataBaseAuditListener;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.util.Date;

@Data
@MappedSuperclass
@DynamicInsert
@DynamicUpdate
@ApiModel(description = "公用字段")
@EntityListeners({AuditingEntityListener.class, DataBaseAuditListener.class})
public class BaseBusiness {

    /**
     * 业务类型
     */
    @Column(name="ywlx")
    private String ywlx;

    /**
     * 录入人
     */
    @Column(name="lrr")
    private Long lrr;

    /**
     * 录入人
     */
    @Column(name="lrrxm")
    @CreatedBy
    private String lrrxm;

    /**
     * 录入时间
     */
    @Column(name="lrsj")
    @CreatedDate
    private Date lrsj;

    /**
     * 录入部门
     */
    @Column(name="lrbm")
    private Long lrbm;

    /**
     * 录入部门名称
     */
    @Column(name="lrbmmc")
    private String lrbmmc;

    /**
     * 更新人
     */
    @Column(name="gxr")
    private Long gxr;

    /**
     * 更新人
     */
    @Column(name="gxrxm")
    @LastModifiedBy
    private String gxrxm;

    /**
     * 更新时间
     */
    @Column(name="gxsj")
    @LastModifiedDate
    private Date gxsj;

    /**
     * 更新部门
     */
    @Column(name="gxbm")
    private Long gxbm;

    /**
     * 更新部门名称
     */
    @Column(name="gxbmmc")
    private String gxbmmc;

    /**
     * 是否有效
     */
    @Column(name="sfyx")
    private String sfyx="1";

    /**
     * 备注
     */
    @Column(name="bz")
    private String bz;
}
